#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

QT_BEGIN_NAMESPACE
namespace Ui {
class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
protected:

    //事件都是虚函数，重写时返回值，参数要一致
    //键盘点击事件
    void keyPressEvent(QKeyEvent *event) override;
    //计时器事件
    void timerEvent(QTimerEvent *event) override;
    //鼠标点击事件
    void mousePressEvent(QMouseEvent *event) override;
    //关闭事件
    void closeEvent(QCloseEvent *event) override;

    //重写event事件
    bool event(QEvent *event) override;
    //重写事件过滤器
    bool eventFilter(QObject *watched, QEvent *event) override;
private:
    Ui::Widget *ui;

    int timeId ;
    int timeId2;
};
#endif // WIDGET_H
